* gtk/tmpl/gtktextview.sgml: Small additions.
* gtk/tmpl/gtksignal.sgml: Explain what to use instead.
* gtk/question_index.sgml, gtk/text_widget.sgml, gtk/tree_widget.sgml,
gtk/changes-1.2.sgml, gtk/changes-2.0.sgml,
gtk/framebuffer.sgml: SGML fixes and additions.
* gtk/tmpl/gtksignal.sgml, gtk/tmpl/gtkdialog.sgml,
gtk/tmpl/gtkeditable.sgml, gtk/tmpl/gtkfilesel.sgml,
gtk/tmpl/gtkmain.sgml, gtk/tmpl/gtkmenu.sgml,
gtk/tmpl/gtkmessagedialog.sgml, gtk/tmpl/gtkrc.sgml,
gtk/tmpl/gtktogglebutton.sgml, gtk/tmpl/gtkspinbutton.sgml,
gtk/tmpl/gtkpaned.sgml, gtk/tmpl/gtkwindow.sgml:
Replace references to deprecated functions.
+2002-01-04 Matthias Clasen <matthiasc@poet.de>
+
+ * gtk/tmpl/gtktextview.sgml: Small additions.
+
+ * gtk/tmpl/gtksignal.sgml: Explain what to use instead.
+
+ * gtk/question_index.sgml, gtk/text_widget.sgml, gtk/tree_widget.sgml,
+ gtk/changes-1.2.sgml, gtk/changes-2.0.sgml,
+ gtk/framebuffer.sgml: SGML fixes and additions.
+
+ * gtk/tmpl/gtksignal.sgml, gtk/tmpl/gtkdialog.sgml,
+ gtk/tmpl/gtkeditable.sgml, gtk/tmpl/gtkfilesel.sgml,
+ gtk/tmpl/gtkmain.sgml, gtk/tmpl/gtkmenu.sgml,
+ gtk/tmpl/gtkmessagedialog.sgml, gtk/tmpl/gtkrc.sgml,
+ gtk/tmpl/gtktogglebutton.sgml, gtk/tmpl/gtkspinbutton.sgml,
+ gtk/tmpl/gtkpaned.sgml, gtk/tmpl/gtkwindow.sgml:
+ Replace references to deprecated functions.
+
2002-01-03 Matthias Clasen <matthiasc@poet.de>
* gtk/changes-1.2.sgml, gtk/changes-2.0.sgml,
Here is the list of the old names and replacements:
-<programlisting>
- Old: Replacement:
-
- gtk_accel_label_accelerator_width gtk_accel_label_get_accel_width
- gtk_check_menu_item_set_state gtk_check_menu_item_set_active
- gtk_container_border_width gtk_container_set_border_width
- gtk_label_set gtk_label_set_text
- gtk_notebook_current_page gtk_notebook_get_current_page
- gtk_packer_configure gtk_packer_set_child_packing
- gtk_paned_gutter_size gtk_paned_set_gutter_size
- gtk_paned_handle_size gtk_paned_set_handle_size
- gtk_scale_value_width gtk_scale_get_value_width
- gtk_style_apply_default_pixmap gtk_style_apply_default_background (1)
- gtk_toggle_button_set_state gtk_toggle_button_set_active
- gtk_window_position gtk_window_set_position
-
- (1) gtk_style_apply_default_background() has an additional
- argument, gboolean set_bg. This parameter should be
+<informaltable>
+<thead>
+<row><entry>Old</entry><entry>Replacement</entry></row>
+</thead>
+<tbody>
+<row><entry><function>gtk_accel_label_accelerator_width</function></entry><entry><function>gtk_accel_label_get_accel_width</function></entry></row>
+<row><entry><function>gtk_check_menu_item_set_state</function></entry><entry><function>gtk_check_menu_item_set_active</function></entry></row>
+<row><entry><function>gtk_container_border_width</function></entry><entry><function>gtk_container_set_border_width</function></entry></row>
+<row><entry><function>gtk_label_set</function></entry><entry><function>gtk_label_set_text</function></entry></row>
+<row><entry><function>gtk_notebook_current_page</function></entry><entry><function>gtk_notebook_get_current_page</function></entry></row>
+<row><entry><function>gtk_packer_configure</function></entry><entry><function>gtk_packer_set_child_packing</function></entry></row>
+<row><entry><function>gtk_paned_gutter_size</function></entry><entry><function>gtk_paned_set_gutter_size</function></entry></row>
+<row><entry><function>gtk_paned_handle_size</function></entry><entry><function>gtk_paned_set_handle_size</function></entry></row>
+<row><entry><function>gtk_scale_value_width</function></entry><entry><function>gtk_scale_get_value_width</function></entry></row>
+<row><entry><function>gtk_style_apply_default_pixmap</function></entry><entry><function>gtk_style_apply_default_background</function></entry></row>
+<row><entry><function>gtk_toggle_button_set_state</function></entry><entry><function>gtk_toggle_button_set_active</function></entry></row>
+<row><entry><function>gtk_window_position</function></entry><entry><function>gtk_window_set_position</function></entry></row>
+</tbody>
+</informaltable>
+Note that <function>gtk_style_apply_default_background()</function> has an
+ additional argument, <literal>set_bg</literal>. This parameter should be
<literal>FALSE</literal> if the background is being set for a
- NO_WINDOW widget, otherwise <literal>TRUE</literal>.
-</programlisting>
+ <literal>NO_WINDOW</literal> widget, otherwise <literal>TRUE</literal>.
</para>
</listitem>
During the development phase of the 1.1.x line of GTK+ certain functions
were deprecated and later removed. Functions affected are:
-<programlisting>
- Removed: Replacement:
- gtk_clist_set_border gtk_clist_set_shadow_type
- gtk_container_block_resize gtk_container_set_resize_mode
- gtk_container_unblock_resize gtk_container_set_resize_mode
- gtk_container_need_resize gtk_container_check_resize
- gtk_ctree_show_stub gtk_ctree_set_show_stub
- gtk_ctree_set_reorderable gtk_clist_set_reorderable
- gtk_ctree_set_use_drag_icons gtk_clist_set_use_drag_icons
- gtk_entry_adjust_scroll (1)
- gtk_object_class_add_user_signal gtk_object_class_user_signal_new
- gtk_preview_put_row gtk_preview_put
- gtk_progress_bar_construct gtk_progress_set_adjustment
- gtk_scrolled_window_construct gtk_scrolled_window_set_{h|v}adjustment
- gtk_spin_button_construct gtk_spin_button_configure
- gtk_widget_thaw_accelerators gtk_widget_unlock_accelerators
- gtk_widget_freeze_accelerators gtk_widget_lock_accelerators
-
-(1) This function is no longer needed as GtkEntry should automatically
- keep the scroll adjusted properly.
+<informaltable>
+<thead>
+<row><entry>Removed</entry><entry>Replacement</entry></row>
+</thead>
+<tbody>
+<row><entry><function>gtk_clist_set_border</function></entry><entry><function>gtk_clist_set_shadow_type</function></entry></row>
+<row><entry><function>gtk_container_block_resize</function></entry><entry><function>gtk_container_set_resize_mode</function></entry></row>
+<row><entry><function>gtk_container_unblock_resize</function></entry><entry><function>gtk_container_set_resize_mode</function></entry></row>
+<row><entry><function>gtk_container_need_resize</function></entry><entry><function>gtk_container_check_resize</function></entry></row>
+<row><entry><function>gtk_ctree_show_stub</function></entry><entry><function>gtk_ctree_set_show_stub</function></entry></row>
+<row><entry><function>gtk_ctree_set_reorderable</function></entry><entry><function>gtk_clist_set_reorderable</function></entry></row>
+<row><entry><function>gtk_ctree_set_use_drag_icons</function></entry><entry><function>gtk_clist_set_use_drag_icons</function></entry></row>
+<row><entry><function>gtk_entry_adjust_scroll</function></entry><entry><function>-</function></entry></row>
+<row><entry><function>gtk_object_class_add_user_signal</function></entry><entry><function>gtk_object_class_user_signal_new</function></entry></row>
+<row><entry><function>gtk_preview_put_row</function></entry><entry><function>gtk_preview_put</function></entry></row>
+<row><entry><function>gtk_progress_bar_construct</function></entry><entry><function>gtk_progress_set_adjustment</function></entry></row>
+<row><entry><function>gtk_scrolled_window_construct</function></entry><entry><function>gtk_scrolled_window_set_{h|v}adjustment</function></entry></row>
+<row><entry><function>gtk_spin_button_construct</function></entry><entry><function>gtk_spin_button_configure</function></entry></row>
+<row><entry><function>gtk_widget_thaw_accelerators</function></entry><entry><function>gtk_widget_unlock_accelerators</function></entry></row>
+<row><entry><function>gtk_widget_freeze_accelerators</function></entry><entry><function>gtk_widget_lock_accelerators</function></entry></row>
+</tbody>
+</informaltable>
+
+Note that <function>gtk_entry_adjust_scroll()</function> is no longer needed
+ as <structname>GtkEntry</structname> should automatically keep the scroll
+ adjusted properly.
</programlisting>
</para>
</listitem>
<para>
To add scrollbars to a non self-scrolling widget, (such as a
- <function>GtkList</function>),
+ <structname>GtkList</structname>),
first add it to a viewport, then add the viewport to a scrolled window.
The scrolled window code provides a convenience function to do this:
Therefore, if you have code like:
-<programlisting>
+<informalexample><programlisting>
gboolean frozen;
frozen = GTK_CLIST_FROZEN (clist);
gtk_clist_freeze (clist);
[...]
if (!frozen)
gtk_clist_thaw (clist);
-</programlisting>
+</programlisting></informalexample>
it will not work anymore. It must be, simply:
-<programlisting>
+<informalexample><programlisting>
gtk_clist_freeze (clist);
[...]
gtk_clist_thaw (clist);
-</programlisting>
+</programlisting></informalexample>
</para>
</listitem>
</para>
<para>In particular, this means, if you are writing widgets
- that might be used in threaded programs, you _must_
+ that might be used in threaded programs, you <emphasis>must</emphasis>
surround timeouts and idle functions in this matter.
</para>
<listitem>
<para>
-The <function>gdk_time*()</function> functions have been removed. This
+The <function>gdk_time*</function> functions have been removed. This
functionality has been unused since the main loop was moved into GLib
prior to 1.2.
</para>
<listitem>
<para>
The following type functions vanished/were replaced:
-<programlisting>
- Old Function Replacement
- gtk_type_query() - being investigated -
- gtk_type_set_varargs_type() -
- gtk_type_get_varargs_type() -
- gtk_type_check_object_cast() g_type_check_instance_cast()
- gtk_type_check_class_cast() g_type_check_class_cast()
- gtk_type_describe_tree() -
- gtk_type_describe_heritage() -
- gtk_type_free() -
- gtk_type_children_types() g_type_children()
- gtk_type_set_chunk_alloc() GTypeInfo.n_preallocs
- gtk_type_register_enum() g_enum_register_static()
- gtk_type_register_flags() g_flags_register_static()
- gtk_type_parent_class() g_type_parent() /
- g_type_class_peek_parent()
-</programlisting>
- Use of g_type_class_ref() / g_type_class_unref() and g_type_class_peek()
- is recommended over usage of gtk_type_class().
- Use of g_type_register_static() / g_type_register_dynamic() is recommended
- over usage of gtk_type_unique().
+<informaltable>
+<thead>
+<row><entry>Old Function</entry><entry>Replacement</entry></row>
+</thead>
+<tbody>
+<row><entry><function>gtk_type_query()</function></entry><entry>being investigated</entry></row>
+<row><entry><function>gtk_type_set_varargs_type()</function></entry><entry>-</entry></row>
+<row><entry><function>gtk_type_get_varargs_type()</function></entry><entry>-</entry></row>
+<row><entry><function>gtk_type_check_object_cast()</function></entry><entry><function>g_type_check_instance_cast()</function></entry></row>
+<row><entry><function>gtk_type_check_class_cast()</function></entry><entry><function>g_type_check_class_cast()</function></entry></row>
+<row><entry><function>gtk_type_describe_tree()</function></entry><entry>-</entry></row>
+<row><entry><function>gtk_type_describe_heritage()</function></entry><entry>-</entry></row>
+<row><entry><function>gtk_type_free()</function></entry><entry>-</entry></row>
+<row><entry><function>gtk_type_children_types()</function></entry><entry><function>g_type_children()</function></entry></row>
+<row><entry><function>gtk_type_set_chunk_alloc()</function></entry><entry><structfield>GTypeInfo.n_preallocs</structfield></entry></row>
+<row><entry><function>gtk_type_register_enum()</function></entry><entry><function>g_enum_register_static()</function></entry></row>
+<row><entry><function>gtk_type_register_flags()</function></entry><entry><function>g_flags_register_static()</function></entry></row>
+<row><entry><function>gtk_type_parent_class()</function></entry><entry><functiono>g_type_parent()</function>/<function>g_type_class_peek_parent()</function></entry></row>
+</tbody>
+</informaltable>
+ Use of <function>g_type_class_ref()</function>/<function>g_type_class_unref()</function> and <function>g_type_class_peek()</function>
+ is recommended over usage of <function>gtk_type_class()</function>.
+ Use of <function>g_type_register_static()</function>/<function>g_type_register_dynamic()</function> is recommended
+ over usage of <function>gtk_type_unique()</function>.
</para>
</listitem>
</itemizedlist>
<listitem>
<para>
-<structname>GtkObject</structname> has no <literal>klass</literal> field anymore, an object's class can be retrieved
+<structname>GtkObject</structname> has no <structfield>klass</structfield> field anymore, an object's class can be retrieved
with the object's coresponding <literal>GTK_<OBJECT>_GET_CLASS (object)</literal>
macro.
</para>
</listitem>
<listitem>
<para>
-<structname>GtkObjectClass</structname> has no <literal>type</literal> field anymore, a class's type can be retrived
+<structname>GtkObjectClass</structname> has no <structfield>type</structfield> field anymore, a class's type can be retrived
with the <literal>GTK_CLASS_TYPE (class)</literal> macro.
</para>
</listitem>
anymore. While <function>shutdown()</function> is intended for GTK+ internal use only, <function>finalize()</function>
is required by a variety of object implementations. <function>GObjectClass.finalize</function>
should be overriden here, e.g.:
-<programlisting>
+<informalexample><programlisting>
static void gtk_label_finalize (GObject *gobject)
{
GtkLabel *label = GTK_LABEL (gobject);
gobject_class->finalize = gtk_label_finalize;
}
-</programlisting>
+</programlisting></informalexample>
</para>
</listitem>
::destroy implementations should check that make sure that they take this
into account, by checking to make sure that resources are there before
freeing them. For example:
-<programlisting>
+<informalexample><programlisting>
if (object->foo_data)
{
g_free (object->foo_data);
object->foo_data = NULL;
}
-</programlisting>
+</programlisting></informalexample>
Also, ::destroy implementations have to release object references that
the object holds. Code in finalize implementations such as:
-<programlisting>
+<informalexample><programlisting>
if (object->adjustment)
{
gtk_object_unref (object->adjustment);
object->adjustment = NULL;
}
-</programlisting>
+</programlisting></informalexample>
have to be moved into the ::destroy implementations. The reason for doing
this is that all object reference cycles should be broken at destruction
time.
<listitem>
<para>
Signal system changes:
- The GTK+ 2.0 signal system merely proxies the <structname>GSignal</structname
+ The GTK+ 2.0 signal system merely proxies the <structname>GSignal</structname>
system now. For future usage, direct use of the
<structname>GSignal</structname> API is recommended,
this avoids significant performance hits where <structname>GtkArg</structname>
- structures have to be converted into <structname>GValues</structname>. For
+ structures have to be converted into <structname>GValue</structname>s. For
language bindings, <structname>GSignal</structname>+</structname>GClosure</structname>
provide a much more flexible and convenient mechanism to hook into signal
emissions or install class default handlers, so the old
<listitem>
<para>
-The <literal>->label</literal> field of <structname>GtkFrame</structname>
- widgets has been removed. (As part of a change to allow arbitrary widgets
- in the title position.) The text can now be retrieved with the new function
+The <structfield>label</structfield> field of <structname>GtkFrame</structname>
+ widgets has been removed (as part of a change to allow arbitrary widgets
+ in the title position). The text can now be retrieved with the new function
<function>gtk_frame_get_text()</function>.
</para>
</listitem>
<listitem>
<para>
-<literal>xthickness</literal>/</literal>ythickness</literal> have moved from
+<structfield>xthickness</structfield> and <structfield>ythickness</structfield> have moved from
<structname>GtkStyleClass</structname> to <structname>GtkStyle</structname>
(from class to instance). This gives themes a bit more flexibility
and is generally more of the Right Thing. You can trivially fix
your code with <literal>s/style->klass->xthickness/style->xthickness/g</literal> and
- same for <literal>ythickness</literal>.
+ same for <structfield>ythickness</structfield>.
</para>
</listitem>
<listitem>
<para>
-Some <structname>GtkStyle</structname> <function>draw_*()</function> methods
+Some <structname>GtkStyle</structname> <function>draw_*</function> methods
have been removed (cross, oval, ramp)
and others have been added (expander, layout). This will require
changes to theme engines.
clarity. #defines to provide backwards compatibility have been
included, but can be disabled by defining <literal>GDK_DISABLE_DEPRECATED</literal>.
-<programlisting>
- #define gdk_draw_pixmap gdk_draw_drawable
- #define gdk_draw_bitmap gdk_draw_drawable
-
- #define gdk_window_get_size gdk_drawable_get_size
- #define gdk_window_get_type gdk_window_get_window_type
- #define gdk_window_get_colormap gdk_drawable_get_colormap
- #define gdk_window_set_colormap gdk_drawable_set_colormap
- #define gdk_window_get_visual gdk_drawable_get_visual
-
- #define gdk_window_ref gdk_drawable_ref
- #define gdk_window_unref gdk_drawable_unref
- #define gdk_bitmap_ref gdk_drawable_ref
- #define gdk_bitmap_unref gdk_drawable_unref
- #define gdk_pixmap_ref gdk_drawable_ref
- #define gdk_pixmap_unref gdk_drawable_unref
-
- #define gdk_gc_destroy gdk_gc_unref
- #define gdk_image_destroy gdk_image_unref
- #define gdk_cursor_destroy gdk_cursor_unref
-
- (Note that g_object_ref() and g_object_unref() may be used for all of
- the above _ref and _unref functions.)
-
- #define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) \
- gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)
-
- #define gdk_rgb_get_cmap gdk_rgb_get_colormap
-</programlisting>
+<informaltable>
+<thead>
+<row><entry>Old function</entry><entry>Defined As</entry></row>
+</thead>
+<tbody>
+<row><entry><function>gdk_draw_pixmap</function></entry><entry><function>gdk_draw_drawable</function></entry></row>
+ <row><entry><function>gdk_draw_bitmap</function></entry><entry><function>gdk_draw_drawable</function></entry></row>
+<row><entry><function>gdk_window_get_size</function></entry><entry><function>gdk_drawable_get_size</function></entry></row>
+<row><entry><function>gdk_window_get_type</function></entry><entry><function>gdk_window_get_window_type</function></entry></row>
+<row><entry><function>gdk_window_get_colormap</function></entry><entry><function>gdk_drawable_get_colormap</function></entry></row>
+<row><entry><function>gdk_window_set_colormap</function></entry><entry><function>gdk_drawable_set_colormap</function></entry></row>
+<row><entry><function>gdk_window_get_visual</function></entry><entry><function>gdk_drawable_get_visual</function></entry></row>
+<row><entry><function>gdk_window_ref</function></entry><entry><function>gdk_drawable_ref</function></entry></row>
+<row><entry><function>gdk_window_unref</function></entry><entry><function>gdk_drawable_unref</function></entry></row>
+<row><entry><function>gdk_bitmap_ref</function></entry><entry><function>gdk_drawable_ref</function></entry></row>
+<row><entry><function>gdk_bitmap_unref</function></entry><entry><function>gdk_drawable_unref</function></entry></row>
+<row><entry><function>gdk_pixmap_ref</function></entry><entry><function>gdk_drawable_ref</function></entry></row>
+<row><entry><function>gdk_pixmap_unref</function></entry><entry><function>gdk_drawable_unref</function></entry></row>
+<row><entry><function>gdk_gc_destroy</function></entry><entry><function>gdk_gc_unref</function></entry></row>
+<row><entry><function>gdk_image_destroy</function></entry><entry><function>gdk_image_unref</function></entry></row>
+<row><entry><function>gdk_cursor_destroy</function></entry><entry><function>gdk_cursor_unref</function></entry></row>
+<row><entry><function>gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height)</function></entry><entry><function>gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)</function></entry></row>
+<row><entry><function>gdk_rgb_get_cmap</function></entry><entry><function>gdk_rgb_get_colormap</function></entry></row>
+</tbody>
+</informaltable>
+ (Note that <function>g_object_ref()</function> and
+ <function>g_object_unref()</function> may be used for all of the above ref
+ and unref functions.)
<function>gtk_widget_popup()</function> was removed, it was only usable
for <structname>GtkWindow</structname>s, and there the same effect can be
<itemizedlist>
<listitem>
<para>
-Only 3 or 4 functions are really needed for 95% of progress
- interfaces; <structname>GtkProgress[Bar]</structname> had about 25
- functions, and didn't even include these 3 or 4.
+Only 3 or 4 functions are really needed for 95% of progress interfaces;
+ <structname>GtkProgress</structname>/<structname>GtkProgressBar</structname>
+ had about 25 functions, and didn't even include these 3 or 4.
</para>
</listitem>
<listitem>
<para>
-The <structname>GdkExposeEvent</structname> has a new <literal>region</literal>
- field. This can be used instead of the <literal>area</literal> field if you
+The <structname>GdkExposeEvent</structname> has a new <structfield>region</structfield>
+ field. This can be used instead of the <structfield>area</structfield> field if you
want a more exact representation of the area to update.
</para>
</listitem>
<listitem>
<para>
-<structname>GtkMenuBar</structname> now draws the GtkContainer::border_width
+<structname>GtkMenuBar</structname> now draws the <structfield>GtkContainer::border_width</structfield>
space outside the frame, not inside the frame.
</para>
</listitem>
<para>
Other removed <structname>GtkContainer</structname> functions with the replacements:
-<programlisting>
- gtk_container_add_child_arg_type => gtk_container_class_install_child_property
- gtk_container_query_child_args => gtk_container_class_list_child_properties
- gtk_container_child_getv => gtk_container_child_set_property
- gtk_container_child_setv => gtk_container_child_get_property
- gtk_container_add_with_args => gtk_container_add_with_properties
- gtk_container_addv => gtk_container_add / gtk_container_child_set_property
-</programlisting>
+<informaltable>
+<thead>
+<row><entry>Old function</entry><entry>Replacement</entry></row>
+</thead>
+<tbody>
+<row><entry><function>gtk_container_add_child_arg_type</function></entry><entry><function>gtk_container_class_install_child_property</function></entry></row>
+<row><entry><function>gtk_container_query_child_args</function></entry><entry><function>gtk_container_class_list_child_properties</function></entry></row>
+<row><entry><function>gtk_container_child_getv</function></entry><entry><function>gtk_container_child_set_property</function></entry></row>
+<row><entry><function>gtk_container_child_setv</function></entry><entry><function>gtk_container_child_get_property</function></entry></row>
+<row><entry><function>gtk_container_add_with_args</function></entry><entry><function>gtk_container_add_with_properties</function></entry></row>
+<row><entry><function>gtk_container_addv</function></entry><entry><function>gtk_container_add</function>/<function>gtk_container_child_set_property</function></entry></row>
+</tbody>
+</informaltable>
</para>
</listitem>
<para>
An example of a font alias file for the urw fontset is:
-<programlisting>
+<informalexample><programlisting>
sans normal normal normal normal "urw gothic l"
serif normal normal normal normal "urw palladio l"
monospace normal normal normal normal "nimbus mono l"
-</programlisting>
+</programlisting></informalexample>
</para>
<para>
And one using the Windows TrueType fonts is:
-<programlisting>
+<informalexample><programlisting>
sans normal normal normal normal "arial"
serif normal normal normal normal "times new roman"
monospace normal normal normal normal "courier new"
-</programlisting>
+</programlisting></informalexample>
A more detailed example can be found in
<filename>examples/pangoft2.aliases</filename> in the
linkend="gtk-text-iter-get-text">gtk_text_iter_get_text()</link>.
</para>
<para>
-<programlisting>
+<informalexample><programlisting>
GtkTextIter start, end;
GtkTextBuffer *buffer;
char *text;
text = gtk_text_iter_get_text (&start, &end);
/* use text */
g_free (text);
-</programlisting>
+</programlisting></informalexample>
</para></answer>
</qandaentry>
<footnote>
<para>
If you want to place the cursor in response to a user action, be sure to use
-gtk_text_buffer_place_cursor(), which moves both at once without causing a
-temporary selection (moving one then the other temporarily selects the range in
-between the old and new positions).
+<function>gtk_text_buffer_place_cursor()</function>, which moves both at once
+without causing a temporary selection (moving one then the other temporarily
+selects the range in between the old and new positions).
</para>
</footnote>
</para>
<para>
The simplest usage of <link linkend="GtkTextView">GtkTextView</link>
might look like this:
-<programlisting>
+<informalexample><programlisting>
GtkWidget *view;
GtkTextBuffer *buffer;
* screen; when the user edits the text, signals on the buffer
* will be emitted, such as "changed", "insert_text", and so on.
*/
-</programlisting>
+</programlisting></informalexample>
In many cases it's also convenient to first create the buffer with
-gtk_text_buffer_new(), then create a widget for that buffer with
-gtk_text_view_new_with_buffer(). Or you can change the buffer the
-widget displays after the widget is created with
-gtk_text_view_set_buffer().
+<function>gtk_text_buffer_new()</function>, then create a widget for that
+buffer with <function>gtk_text_view_new_with_buffer()</function>. Or you can
+change the buffer the widget displays after the widget is created with
+<function>gtk_text_view_set_buffer()</function>.
</para>
</refsect1>
<link linkend="GtkTextView">GtkTextView</link> such as
<link linkend="gtk-text-view-set-tabs">gtk_text_view_set_tabs()</link>.
-<programlisting>
+<informalexample><programlisting>
GtkWidget *view;
GtkTextBuffer *buffer;
PangoFontDescription *font_desc;
gtk_text_buffer_get_iter_at_offset (buffer, &start, 7);
gtk_text_buffer_get_iter_at_offset (buffer, &end, 12);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
-</programlisting>
+</programlisting></informalexample>
</para>
/* Ensure that the dialog box is destroyed when the user responds. */
- gtk_signal_connect_object (GTK_OBJECT (dialog), "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
+ g_signal_connect_swapped (GTK_OBJECT (dialog),
+ "response",
+ G_CALLBACK (gtk_widget_destroy),
+ GTK_OBJECT (dialog));
/* Add the label, and show everything we've added to the dialog. */
for (i = 0; i < length; i++)
result[i] = islower (text[i]) ? toupper (text[i]) : text[i];
- gtk_signal_handler_block_by_func (GTK_OBJECT (editable),
- GTK_SIGNAL_FUNC (insert_text_handler),
- data);
+ g_signal_handlers_block_by_func (GTK_OBJECT (editable),
+ insert_text_handler, data);
gtk_editable_insert_text (editable, result, length, position);
- gtk_signal_handler_unblock_by_func (GTK_OBJECT (editable),
- GTK_SIGNAL_FUNC (insert_text_handler),
- data);
+ g_signal_handlers_unblock_by_func (GTK_OBJECT (editable),
+ insert_text_handler, data);
- gtk_signal_emit_stop_by_name (GTK_OBJECT (editable), "insert_text");
+ g_signal_stop_emission_by_name (GTK_OBJECT (editable), "insert_text");
g_free (result);
}
file_selector = gtk_file_selection_new ("Please select a file for editing.");
- gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
- "clicked", GTK_SIGNAL_FUNC (store_filename), NULL);
+ g_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
+ "clicked",
+ G_CALLBACK (store_filename),
+ NULL);
/* Ensure that the dialog box is destroyed when the user clicks a button. */
- gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
- "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
- (gpointer) file_selector);
-
- gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->cancel_button),
- "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
- (gpointer) file_selector);
+ g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
+ "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ (gpointer) file_selector);
+
+ g_signal_connect_swapped (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->cancel_button),
+ "clicked",
+ G_CALLBACK (gtk_widget_destroy),
+ (gpointer) file_selector);
/* Display that dialog */
gtk_init( &argc, &argv );
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- gtk_signal_connect (GTK_OBJECT(win), "delete-event",
- (GtkSignalFunc) gtk_true, NULL);
- gtk_signal_connect (GTK_OBJECT(win), "destroy",
- (GtkSignalFunc) gtk_main_quit, NULL);
+ g_signal_connect (GTK_OBJECT(win), "delete-event",
+ G_CALLBACK (gtk_true), NULL);
+ g_signal_connect (GTK_OBJECT(win), "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
but = gtk_button_new_with_label ("Close yourself. I mean it!");
- gtk_signal_connect_object (
- GTK_OBJECT (but), "clicked",
- (GtkSignalFunc) gtk_object_destroy, (gpointer) win );
+ g_signal_connect_swapped (GTK_OBJECT (but), "clicked",
+ G_CALLBACK (gtk_object_destroy), (gpointer) win);
gtk_container_add (GTK_CONTAINER (win), but);
gtk_widget_show_all (win);
<title>Connecting the popup signal handler.</title>
<programlisting>
/* connect our handler which will popup the menu */
- gtk_signal_connect_object (GTK_OBJECT (window), "button_press_event",
- GTK_SIGNAL_FUNC (my_popup_handler), GTK_OBJECT (menu));
+ g_signal_connect_swapped (GTK_OBJECT (window), "button_press_event",
+ G_CALLBACK (my_popup_handler), GTK_OBJECT (menu));
</programlisting>
</example>
g_return_val_if_fail (event != NULL, FALSE);
/* The "widget" is the menu that was supplied when
- * gtk_signal_connect_object was called.
+ * g_signal_connect_swapped() was called.
*/
menu = GTK_MENU (widget);
filename, g_strerror (errno));
/* Destroy the dialog when the user responds to it (e.g. clicks a button) */
- gtk_signal_connect_object (GTK_OBJECT (dialog), "response",
- GTK_SIGNAL_FUNC (gtk_widget_destroy),
- GTK_OBJECT (dialog));
+ g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
+ G_CALLBACK (gtk_widget_destroy),
+ GTK_OBJECT (dialog));
</programlisting>
</example>
</para>
gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN);
gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_IN);
-gtk_widget_set_usize (hpaned, 200 + GTK_PANED (hpaned)->gutter_size, -1);
+gtk_widget_set_size_request (hpaned, 200 + GTK_PANED (hpaned)->gutter_size, -1);
gtk_paned_pack1 (GTK_PANED (hpaned), frame1, TRUE, FALSE);
-gtk_widget_set_usize (frame1, 50, -1);
+gtk_widget_set_size_request (frame1, 50, -1);
gtk_paned_pack2 (GTK_PANED (hpaned), frame1, FALSE, FALSE);
-gtk_widget_set_usize (frame1, 50, -1);
+gtk_widget_set_size_request (frame1, 50, -1);
</programlisting>
</example>
The action that is bound to the key is a sequence
of signal names (strings) followed by parameters for
each signal. The signals must be action signals.
-(See gtk_signal_new()). Each parameter can be
+(See g_signal_new()). Each parameter can be
a float, integer, string, or unquoted string
representing an enumeration value. The types of
the parameters specified must match the types of the
Object methods and callbacks.
<!-- ##### SECTION Long_Description ##### -->
+<para>
+The GTK+ signal system merely proxies the GLib signal system now. For future
+usage, direct use of the #GSignal API is recommended, this avoids significant
+performance hits where #GtkArg structures have to be converted into #GValues.
+</para>
+
<refsect2>
<title>What are signals?</title>
<para>
The functions responsible for translating an array of #GtkArgs
to your C compiler's normal semantics are called Marshallers.
They are identified by
-gtk_marshal_return_value__parameter_list()
+gtk_marshal_<replaceable>return_value</replaceable>__<replaceable>parameter_list</replaceable>()
for example a C function returning a gboolean and taking a gint
can be invoked by using gtk_marshal_BOOL__INT().
Not all possibly combinations of return/params are available,
</para>
@object: the object whose signal handlers you wish to stop.
-@signal_id: the signal identifier, as returned by gtk_signal_lookup().
+@signal_id: the signal identifier, as returned by g_signal_lookup().
<!-- # Unused Parameters # -->
@i:
@s:
*/
gfloat grab_int_value (GtkSpinButton *a_spinner, gpointer user_data) {
- return gtk_spin_button_get_value_as_float (a_spinner);
+ return gtk_spin_button_get_value (a_spinner);
}
void create_floating_spin_button (void) {
<!-- ##### MACRO GTK_TEXT_VIEW_PRIORITY_VALIDATE ##### -->
<para>
-
+The priority at which the text view validates onscreen lines
+in an idle job in the background.
</para>
/* Makes this toggle button invisible */
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle1), TRUE);
- gtk_signal_connect (GTK_OBJECT (toggle1), "toggled",
- GTK_SIGNAL_FUNC (output_state), NULL);
+ g_signal_connect (GTK_OBJECT (toggle1), "toggled",
+ G_CALLBACK (output_state), NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
toggle1, FALSE, FALSE, 2);
toggle2 = gtk_toggle_button_new_with_label ("Hi, i'm another toggle button.");
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (toggle2), FALSE);
- gtk_signal_connect (GTK_OBJECT (toggle2), "toggled",
- GTK_SIGNAL_FUNC (output_state), NULL);
+ g_signal_connect (GTK_OBJECT (toggle2), "toggled",
+ G_CALLBACK (output_state), NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area),
toggle2, FALSE, FALSE, 2);
<para>
Sometimes when you think you want to use @allow_shrink, the real problem is that
some specific child widget is requesting too much space, so the user can't
-shrink the window sufficiently. Perhaps you are calling gtk_widget_set_usize()
+shrink the window sufficiently. Perhaps you are calling gtk_widget_set_size_request()
on a child widget, and forcing its size request to be too large. Instead of
setting the child's usize, consider using gtk_window_set_default_size() so that
the child gets a larger allocation than it requests.
<firstterm>Model/View/Controller</firstterm> design and consists
of four major parts:
<simplelist>
- <member>the tree view widget (GtkTreeView)</member>
- <member>the view column (GtkTreeViewColumn)</member>
- <member>the cell renderers (GtkCellRenderer etc.)</member>
- <member>and the model interface (GtkTreeModel)</member>
+ <member>the tree view widget (<structname>GtkTreeView</structname>)</member>
+ <member>the view column (<structname>GtkTreeViewColumn</structname>)</member>
+ <member>the cell renderers (<structname>GtkCellRenderer</structname> etc.)</member>
+ <member>and the model interface (<structname>GtkTreeModel</structname>)</member>
</simplelist>
The <emphasis>View</emphasis> is composed of the first three,
while the last is the <emphasis>Model</emphasis>. One of the
data — that is left as an exercise for the reader. More
information can be found on this in the <link
linkend="GtkTreeStore">GtkTreeModel</link> section.
- <programlisting><![CDATA[
+ <informalexample><programlisting><![CDATA[
{
GtkTreeStore *model;
GtkWidget *view;
gtk_tree_view_append_column (GTK_TREE_VIEW (view), column);
}
]]>
- </programlisting>
+ </programlisting></informalexample>
</para>
</refsect1>
</refentry>